package view;

import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import javax.swing.JPanel;
import model.Photo;

/*
 * This is the ImageView class. It can display an Image that is contained in a
 * Photo model.
 * This class should be added to the MainView class's CardLayout.
 */
public class ImageView extends JPanel{
    private Photo photo;

    public ImageView(Photo photo){
        this.photo = photo;
        setPreferredSize(new Dimension(300, 300));
    }
    
    @Override
    public void paintComponent(Graphics g){
        Image image = photo.getImage();
        g.drawImage(image, 0, 0, getBackground(), this);
    }
}